<template>
  <div>
    <h1>当前num值：{{num}}</h1>
    <button @click="subnum()">num--</button>
  </div>
</template>

<script>
  import {mapMutations} from 'vuex'
  import {mapState} from 'vuex'
  export default {
    name: 'Sub',
    computed: {
      ...mapState(['num'])
    },
    methods: {
      ...mapMutations(['subnum'])
    }
  }
</script>

<style>
</style>